VERSION 5.00
Object = "{D6497A70-C7D9-48A0-8980-21E5DFA268FC}#1.0#0"; "POSControl.ocx"
Begin VB.Form frmEntrarPagos 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Registrar Pagos"
   ClientHeight    =   4995
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6210
   Icon            =   "frmPagos.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4995
   ScaleWidth      =   6210
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin POSControl.lblTotal lblTotal1 
      Height          =   885
      Left            =   2340
      TabIndex        =   21
      Top             =   30
      Width           =   3885
      _ExtentX        =   6853
      _ExtentY        =   1561
   End
   Begin VB.CommandButton cmdSalir 
      BackColor       =   &H80000014&
      Caption         =   "&Salir"
      Height          =   375
      Left            =   4440
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   4560
      Width           =   1485
   End
   Begin VB.CommandButton cmdRegistrar 
      BackColor       =   &H80000014&
      Caption         =   "&Registrar"
      Height          =   375
      Left            =   2880
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   4560
      Width           =   1485
   End
   Begin VB.Frame fraContenedor 
      BackColor       =   &H00808080&
      BorderStyle     =   0  'None
      ClipControls    =   0   'False
      Height          =   3555
      Left            =   0
      TabIndex        =   6
      Top             =   900
      Width           =   8295
      Begin VB.TextBox txtMonto 
         Alignment       =   1  'Right Justify
         Height          =   315
         Left            =   1530
         TabIndex        =   1
         Text            =   "00.00"
         Top             =   1110
         Width           =   1965
      End
      Begin VB.ComboBox cboFormaPago 
         Height          =   315
         ItemData        =   "frmPagos.frx":000C
         Left            =   1560
         List            =   "frmPagos.frx":0022
         Style           =   2  'Dropdown List
         TabIndex        =   0
         Top             =   750
         Width           =   1935
      End
      Begin VB.Frame Frame1 
         BackColor       =   &H00808080&
         Height          =   1035
         Left            =   60
         TabIndex        =   11
         Top             =   2340
         Width           =   3345
         Begin VB.Label lblTotalPagado 
            Alignment       =   1  'Right Justify
            BackStyle       =   0  'Transparent
            Caption         =   "00.00"
            ForeColor       =   &H00FFFFFF&
            Height          =   315
            Left            =   1830
            TabIndex        =   17
            Top             =   240
            Width           =   945
         End
         Begin VB.Label lblFaltaDescargar 
            Alignment       =   1  'Right Justify
            BackStyle       =   0  'Transparent
            Caption         =   "00.00"
            ForeColor       =   &H00FFFFFF&
            Height          =   315
            Left            =   1830
            TabIndex        =   16
            Top             =   480
            Width           =   945
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "TOTAL PAGADO S/."
            ForeColor       =   &H00FFFFFF&
            Height          =   195
            Index           =   0
            Left            =   120
            TabIndex        =   15
            Top             =   240
            Width           =   1515
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "FALTA DESCARGAR S/."
            ForeColor       =   &H00FFFFFF&
            Height          =   195
            Left            =   120
            TabIndex        =   14
            Top             =   480
            Width           =   1815
         End
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "CAMBIO S/."
            ForeColor       =   &H00FFFFFF&
            Height          =   195
            Left            =   120
            TabIndex        =   13
            Top             =   720
            Width           =   885
         End
         Begin VB.Label lblCambio 
            Alignment       =   1  'Right Justify
            BackStyle       =   0  'Transparent
            Caption         =   "00.00"
            ForeColor       =   &H00FFFFFF&
            Height          =   315
            Left            =   1830
            TabIndex        =   12
            Top             =   720
            Width           =   945
         End
      End
      Begin VB.Frame frListaResultados 
         BackColor       =   &H80000014&
         Height          =   615
         Left            =   -30
         TabIndex        =   9
         Top             =   1650
         Width           =   15255
         Begin VB.Label Label7 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Totales"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   12
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   90
            TabIndex        =   10
            Top             =   210
            Width           =   900
         End
      End
      Begin VB.CommandButton cmdEliminarPago 
         BackColor       =   &H80000014&
         Caption         =   "&Eliminar Pagos"
         Height          =   375
         Left            =   3600
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   1140
         Width           =   1485
      End
      Begin VB.CommandButton cmdAgregarPago 
         BackColor       =   &H80000014&
         Caption         =   "&Agregar Pago"
         Height          =   375
         Left            =   3600
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   750
         Width           =   1485
      End
      Begin VB.Frame frParametros 
         BackColor       =   &H80000014&
         Height          =   615
         Left            =   -60
         TabIndex        =   7
         Top             =   0
         Width           =   15255
         Begin VB.Label Label6 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Ingresar Pago"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   12
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   120
            TabIndex        =   8
            Top             =   240
            Width           =   1710
         End
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Monto :"
         ForeColor       =   &H00FFFFFF&
         Height          =   195
         Index           =   3
         Left            =   180
         TabIndex        =   20
         Top             =   1170
         Width           =   540
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Forma de Pago :"
         ForeColor       =   &H00FFFFFF&
         Height          =   195
         Index           =   2
         Left            =   180
         TabIndex        =   19
         Top             =   810
         Width           =   1170
      End
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Registrar Pagos "
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   360
      Index           =   1
      Left            =   30
      TabIndex        =   18
      Top             =   480
      Width           =   2055
   End
End
Attribute VB_Name = "frmEntrarPagos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private mvarBean As bpedido
Private mvarlistaPagos As Collection
Private control As New CPedido




Private Sub cboFormaPago_KeyPress(KeyAscii As Integer)
If KeyAscii <> 13 Then Exit Sub
Dim BFormaPago As BFormaPago
Set BFormaPago = mvarlistaPagos.Item(cboFormaPago.ListIndex + 1)
If Not BFormaPago.bEsDolar Then
    Me.txtMonto.Text = Format(bean.nTotal - bean.nTotPagado, "######.00")
Else
    Me.txtMonto.Text = Format((bean.nTotal - bean.nTotPagado) / bparametro.nTipoCambio, "######.00")
End If
Me.txtMonto.SetFocus
End Sub

Private Sub cmdAgregarPago_Click()
Dim bPago As bPago
If cboFormaPago.ListIndex < 0 Then Exit Sub
If Val(Me.txtMonto.Text) = 0 Then
    utilMensaje.muestraMensaje montoDebeSerMayorACero
    Exit Sub
End If
Set bPago = New bPago
Set bPago.BFormaPago = mvarlistaPagos.Item(cboFormaPago.ListIndex + 1)
bPago.nMonto = Me.txtMonto
bean.lPagos.Add bPago
control.calcularPagos bean
muestraPedido
limpiaControles
Me.cmdRegistrar.SetFocus
End Sub
Private Sub limpiaControles()
Me.cboFormaPago.ListIndex = -1
Me.txtMonto.Text = "00.00"
End Sub
Friend Property Get bean() As bpedido
    Set bean = mvarBean
End Property

Friend Property Set bean(bean As bpedido)
    Set mvarBean = bean
    muestraPedido
End Property

Private Sub cmdEliminarPago_Click()
Set mvarBean.lPagos = New Collection
control.calcularPagos bean
muestraPedido
End Sub

Private Sub cmdRegistrar_Click()
Dim result As Integer
result = control.registrar(bean)
If Not result = UtilConstantes.OPT_PEDIDO_FALTA_DESCARGAR Then
    Unload Me
End If
End Sub

Private Sub cmdSalir_Click()
Unload Me
End Sub

Private Sub Form_Load()
    Me.lblTotal1.nTotal = mvarBean.nTotal
End Sub

Friend Property Get listaPagos() As Collection
    Set listaPagos = mvarlistaPagos
End Property

Friend Property Set listaPagos(vdata As Collection)
    Set mvarlistaPagos = vdata
    llenaFormasPago
End Property

Private Sub llenaFormasPago()
Dim i As Integer
Dim BFormaPago As BFormaPago
cboFormaPago.Clear
For i = 1 To listaPagos.Count
    Set BFormaPago = listaPagos.Item(i)
    Me.cboFormaPago.AddItem BFormaPago.sAbreviatura
Next
End Sub
Private Sub muestraPedido()
Me.lblTotalPagado.Caption = Format(bean.nTotPagado, "#####.00")
Me.lblCambio.Caption = Format(bean.nCambio, "#####.00")
If bean.nTotal > bean.nTotPagado Then
    Me.lblFaltaDescargar.Caption = Format(bean.nTotal - bean.nTotPagado, "#####.00")
Else
    Me.lblFaltaDescargar.Caption = Format(0, "#####.00")
End If

End Sub


Private Sub txtMonto_GotFocus()
util.marcaTodo txtMonto
End Sub

Private Sub txtMonto_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    cmdAgregarPago.SetFocus
End If
util.soloNumeros KeyAscii, False
End Sub
